<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    hello
  </div>
  <script>
    let data = {
      msg: 'hello',
      count: 10
    }
    let vm = new Proxy(data, {
      get(target, key) {
        console.log('getter' + key);
        return target[key];
      },
      setter(target, key, newValue) {
        console.log('setter' + key);
        if(target[key] === newValue){
          return
        }
        target[key] = newValue;
        document.querySelector('#app').textContent = target[key]
      }
    })
  </script>
</body>

</html>